﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Hyt.Web.Mvc.Partial.Models
{


    public class TreeTableData<TItem>
    {
        /// <summary>
        /// 全部数据，数据源
        /// </summary>
        public List<TItem> Data { get; set; }

        /// <summary>
        /// 找id
        /// </summary>
        public Func<TItem, string> IdFinder { get; set; }

        /// <summary>
        /// 找parentid
        /// </summary>
        public Func<List<TItem>,TItem, string> ParentIdFinder { get; set; } 

        /// <summary>
        /// 数据格式化器
        /// </summary>
        public List<TreeTableNode<TItem>> Items { get; set; }

    }

    public class TreeTableNode<T>
    {
        public String Name { get; set; }
        
        public Func<T,string> GetContent { get; set; } 
    }
}